/* GUI CONVERTED from rcrp02b.p (converter v1.75) Tue Apr 10 12:05:23 2001 */
/* rcrp02b.p - Release Management Customer Schedules -Schedule Compare SubP   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5 $                                                         */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.3    LAST MODIFIED: 12/23/93           BY: WUG *GI32*          */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan   */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00           BY: *N0KP* Mark Brown   */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.5 $    BY: Jean Miller        DATE: 03/22/01  ECO: *P008*     */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* SCHEDULE COMPARE SUBROUTINE */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}

define input parameter schtype like sch_type.
define input parameter sodnbr like sod_nbr.
define input parameter sodline like sod_line.
define input-output parameter schrlse_1 like sch_rlse_id.
define input-output parameter schrlse_2 like sch_rlse_id.
define output parameter undo_stat like mfc_logical no-undo.
define output parameter next_prompt_fldname as character no-undo.

define shared buffer schmstr1 for sch_mstr.
define shared buffer schmstr2 for sch_mstr.

undo_stat = yes.
next_prompt_fldname = "".

find sod_det where sod_nbr = sodnbr and sod_line = sodline no-lock.

if schrlse_1 = "" then do:
   find last sch_mstr
       where sch_mstr.sch_type = schtype
         and sch_mstr.sch_nbr = sod_nbr
         and sch_mstr.sch_line = sod_line
   use-index sch_cr_date
   no-lock no-error.

   if not available sch_mstr then do:
      /* No schedule records exist */
      {pxmsg.i &MSGNUM=6012 &ERRORLEVEL=3}
      next_prompt_fldname = "schrlse_1".
      undo, leave.
   end.

   find prev sch_mstr
       where sch_mstr.sch_type = schtype
         and sch_mstr.sch_nbr = sod_nbr
         and sch_mstr.sch_line = sod_line
   use-index sch_cr_date
   no-lock no-error.
   if available sch_mstr then do:
      schrlse_1 = sch_mstr.sch_rlse_id.
   end.
   else do:
      /* No schedule records exist */
      {pxmsg.i &MSGNUM=6012 &ERRORLEVEL=3}
      next_prompt_fldname = "schrlse_1".
      undo, leave.
   end.
end.

if schrlse_2 = "" then do:
   find last sch_mstr
       where sch_mstr.sch_type = schtype
         and sch_mstr.sch_nbr = sod_nbr
         and sch_mstr.sch_line = sod_line
   use-index sch_cr_date
   no-lock no-error.

   if available sch_mstr then do:
      schrlse_2 = sch_mstr.sch_rlse_id.
   end.
   else do:
      /* No schedule records exist */
      {pxmsg.i &MSGNUM=6012 &ERRORLEVEL=3}
      next_prompt_fldname = "schrlse_2".
      undo, leave.
   end.
end.

find schmstr1
 where schmstr1.sch_type = schtype
   and schmstr1.sch_nbr = sod_nbr
   and schmstr1.sch_line = sod_line
   and schmstr1.sch_rlse_id = schrlse_1
no-lock no-error.

if not available schmstr1 then do:
   /* Schedule does not exist */
   {pxmsg.i &MSGNUM=6013 &ERRORLEVEL=3}
   next_prompt_fldname = "schrlse_1".
   undo, leave.
end.

find schmstr2
where schmstr2.sch_type = schtype
  and schmstr2.sch_nbr = sod_nbr
  and schmstr2.sch_line = sod_line
  and schmstr2.sch_rlse_id = schrlse_2
no-lock no-error.
if not available schmstr2 then do:
   /* Schedule does not exist */
   {pxmsg.i &MSGNUM=6013 &ERRORLEVEL=3}
   next_prompt_fldname = "schrlse_2".
   undo, leave.
end.

undo_stat = no.
